﻿using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace iPhoneUI
{
    public static class SafeDisposer
    {
        public static void DisposeAll(this IEnumerable collection)
        {
            foreach (IDisposable d in collection.OfType<IDisposable>())
                d.Dispose();
        }

        public static void SafeDispose(this IDisposable d)
        {
            if (d != null)
                d.Dispose();
        }
    }
}
